﻿using Ellanet.Annotations;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Ellanet.Classes
{
    public class Choice : INotifyPropertyChanged
    {
        private bool _isChosen;

        public int Answer { get; }

        public bool IsCorrect { get; }

        public bool IsChosen
        {
            get { return _isChosen; }
            set
            {
                _isChosen = value;
                OnPropertyChanged();
            }
        }

        public Choice(int answer, bool isCorrect)
        {
            Answer = answer;
            IsCorrect = isCorrect;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
